package com.smooth.dao.gen;

import com.smooth.dao.gen.bean.BizStudent;
import com.smooth.dao.gen.bean.BizStudentExample.Criteria;
import com.smooth.dao.gen.bean.BizStudentExample.Criterion;
import com.smooth.dao.gen.bean.BizStudentExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;

public class BizStudentSqlProvider {
    /** biz_student */
    public String countByExample(BizStudentExample example) {
        SQL sql = new SQL();
        sql.SELECT("count(*)").FROM("biz_student");
        applyWhere(sql, example, false);
        return sql.toString();
    }

    /** biz_student */
    public String deleteByExample(BizStudentExample example) {
        SQL sql = new SQL();
        sql.DELETE_FROM("biz_student");
        applyWhere(sql, example, false);
        return sql.toString();
    }

    /** biz_student */
    public String insertSelective(BizStudent record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("biz_student");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=VARCHAR}");
        }
        
        if (record.getStuName() != null) {
            sql.VALUES("stu_name", "#{stuName,jdbcType=VARCHAR}");
        }
        
        if (record.getStuHeight() != null) {
            sql.VALUES("stu_height", "#{stuHeight,jdbcType=DOUBLE}");
        }
        
        if (record.getStuWeight() != null) {
            sql.VALUES("stu_weight", "#{stuWeight,jdbcType=DOUBLE}");
        }
        
        if (record.getJobStatus() != null) {
            sql.VALUES("job_status", "#{jobStatus,jdbcType=INTEGER}");
        }
        
        if (record.getTelNo() != null) {
            sql.VALUES("tel_no", "#{telNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.VALUES("password", "#{password,jdbcType=VARCHAR}");
        }
        
        if (record.getGender() != null) {
            sql.VALUES("gender", "#{gender,jdbcType=SMALLINT}");
        }
        
        if (record.getPercent() != null) {
            sql.VALUES("percent", "#{percent,jdbcType=DOUBLE}");
        }
        
        if (record.getSubjectId() != null) {
            sql.VALUES("subject_id", "#{subjectId,jdbcType=VARCHAR}");
        }
        
        if (record.getSubjectName() != null) {
            sql.VALUES("subject_name", "#{subjectName,jdbcType=VARCHAR}");
        }
        
        if (record.getJifenAllAmount() != null) {
            sql.VALUES("jifen_all_amount", "#{jifenAllAmount,jdbcType=INTEGER}");
        }
        
        if (record.getJifenAmount() != null) {
            sql.VALUES("jifen_amount", "#{jifenAmount,jdbcType=INTEGER}");
        }
        
        if (record.getPicHead() != null) {
            sql.VALUES("pic_head", "#{picHead,jdbcType=VARCHAR}");
        }
        
        if (record.getPicBody() != null) {
            sql.VALUES("pic_body", "#{picBody,jdbcType=VARCHAR}");
        }
        
        if (record.getPicNomake() != null) {
            sql.VALUES("pic_nomake", "#{picNomake,jdbcType=VARCHAR}");
        }
        
        if (record.getPicLife() != null) {
            sql.VALUES("pic_life", "#{picLife,jdbcType=VARCHAR}");
        }
        
        if (record.getCollegeLevel() != null) {
            sql.VALUES("college_level", "#{collegeLevel,jdbcType=VARCHAR}");
        }
        
        if (record.getFaculty() != null) {
            sql.VALUES("faculty", "#{faculty,jdbcType=VARCHAR}");
        }
        
        if (record.getStuNation() != null) {
            sql.VALUES("stu_nation", "#{stuNation,jdbcType=VARCHAR}");
        }
        
        if (record.getBirthday() != null) {
            sql.VALUES("birthday", "#{birthday,jdbcType=DATE}");
        }
        
        if (record.getNativePalce() != null) {
            sql.VALUES("native_palce", "#{nativePalce,jdbcType=VARCHAR}");
        }
        
        if (record.getDomicile() != null) {
            sql.VALUES("domicile", "#{domicile,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceId() != null) {
            sql.VALUES("province_id", "#{provinceId,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceName() != null) {
            sql.VALUES("province_name", "#{provinceName,jdbcType=VARCHAR}");
        }
        
        if (record.getCityId() != null) {
            sql.VALUES("city_id", "#{cityId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityName() != null) {
            sql.VALUES("city_name", "#{cityName,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaId() != null) {
            sql.VALUES("area_id", "#{areaId,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaName() != null) {
            sql.VALUES("area_name", "#{areaName,jdbcType=VARCHAR}");
        }
        
        if (record.getSchId() != null) {
            sql.VALUES("sch_id", "#{schId,jdbcType=VARCHAR}");
        }
        
        if (record.getSchName() != null) {
            sql.VALUES("sch_name", "#{schName,jdbcType=VARCHAR}");
        }
        
        if (record.getHighSchName() != null) {
            sql.VALUES("high_sch_name", "#{highSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getMidSchName() != null) {
            sql.VALUES("mid_sch_name", "#{midSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getScFaculty() != null) {
            sql.VALUES("sc_faculty", "#{scFaculty,jdbcType=VARCHAR}");
        }
        
        if (record.getRuxueTime() != null) {
            sql.VALUES("ruxue_time", "#{ruxueTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getXuekeType() != null) {
            sql.VALUES("xueke_type", "#{xuekeType,jdbcType=SMALLINT}");
        }
        
        if (record.getCreateBy() != null) {
            sql.VALUES("create_by", "#{createBy,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateDate() != null) {
            sql.VALUES("create_date", "#{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.VALUES("update_by", "#{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateDate() != null) {
            sql.VALUES("update_date", "#{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDelFlag() != null) {
            sql.VALUES("del_flag", "#{delFlag,jdbcType=SMALLINT}");
        }
        
        return sql.toString();
    }

    /** biz_student */
    public String selectByExample(BizStudentExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("stu_name");
        sql.SELECT("stu_height");
        sql.SELECT("stu_weight");
        sql.SELECT("job_status");
        sql.SELECT("tel_no");
        sql.SELECT("password");
        sql.SELECT("gender");
        sql.SELECT("percent");
        sql.SELECT("subject_id");
        sql.SELECT("subject_name");
        sql.SELECT("jifen_all_amount");
        sql.SELECT("jifen_amount");
        sql.SELECT("pic_head");
        sql.SELECT("pic_body");
        sql.SELECT("pic_nomake");
        sql.SELECT("pic_life");
        sql.SELECT("college_level");
        sql.SELECT("faculty");
        sql.SELECT("stu_nation");
        sql.SELECT("birthday");
        sql.SELECT("native_palce");
        sql.SELECT("domicile");
        sql.SELECT("province_id");
        sql.SELECT("province_name");
        sql.SELECT("city_id");
        sql.SELECT("city_name");
        sql.SELECT("area_id");
        sql.SELECT("area_name");
        sql.SELECT("sch_id");
        sql.SELECT("sch_name");
        sql.SELECT("high_sch_name");
        sql.SELECT("mid_sch_name");
        sql.SELECT("sc_faculty");
        sql.SELECT("ruxue_time");
        sql.SELECT("xueke_type");
        sql.SELECT("create_by");
        sql.SELECT("create_date");
        sql.SELECT("update_by");
        sql.SELECT("update_date");
        sql.SELECT("del_flag");
        sql.FROM("biz_student");
        applyWhere(sql, example, false);
        
        if (example != null && example.getOrderByClause() != null) {
            sql.ORDER_BY(example.getOrderByClause());
        }
        
        return sql.toString();
    }

    /** biz_student */
    public String updateByExampleSelective(Map<String, Object> parameter) {
        BizStudent record = (BizStudent) parameter.get("record");
        BizStudentExample example = (BizStudentExample) parameter.get("example");
        
        SQL sql = new SQL();
        sql.UPDATE("biz_student");
        
        if (record.getId() != null) {
            sql.SET("id = #{record.id,jdbcType=VARCHAR}");
        }
        
        if (record.getStuName() != null) {
            sql.SET("stu_name = #{record.stuName,jdbcType=VARCHAR}");
        }
        
        if (record.getStuHeight() != null) {
            sql.SET("stu_height = #{record.stuHeight,jdbcType=DOUBLE}");
        }
        
        if (record.getStuWeight() != null) {
            sql.SET("stu_weight = #{record.stuWeight,jdbcType=DOUBLE}");
        }
        
        if (record.getJobStatus() != null) {
            sql.SET("job_status = #{record.jobStatus,jdbcType=INTEGER}");
        }
        
        if (record.getTelNo() != null) {
            sql.SET("tel_no = #{record.telNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.SET("password = #{record.password,jdbcType=VARCHAR}");
        }
        
        if (record.getGender() != null) {
            sql.SET("gender = #{record.gender,jdbcType=SMALLINT}");
        }
        
        if (record.getPercent() != null) {
            sql.SET("percent = #{record.percent,jdbcType=DOUBLE}");
        }
        
        if (record.getSubjectId() != null) {
            sql.SET("subject_id = #{record.subjectId,jdbcType=VARCHAR}");
        }
        
        if (record.getSubjectName() != null) {
            sql.SET("subject_name = #{record.subjectName,jdbcType=VARCHAR}");
        }
        
        if (record.getJifenAllAmount() != null) {
            sql.SET("jifen_all_amount = #{record.jifenAllAmount,jdbcType=INTEGER}");
        }
        
        if (record.getJifenAmount() != null) {
            sql.SET("jifen_amount = #{record.jifenAmount,jdbcType=INTEGER}");
        }
        
        if (record.getPicHead() != null) {
            sql.SET("pic_head = #{record.picHead,jdbcType=VARCHAR}");
        }
        
        if (record.getPicBody() != null) {
            sql.SET("pic_body = #{record.picBody,jdbcType=VARCHAR}");
        }
        
        if (record.getPicNomake() != null) {
            sql.SET("pic_nomake = #{record.picNomake,jdbcType=VARCHAR}");
        }
        
        if (record.getPicLife() != null) {
            sql.SET("pic_life = #{record.picLife,jdbcType=VARCHAR}");
        }
        
        if (record.getCollegeLevel() != null) {
            sql.SET("college_level = #{record.collegeLevel,jdbcType=VARCHAR}");
        }
        
        if (record.getFaculty() != null) {
            sql.SET("faculty = #{record.faculty,jdbcType=VARCHAR}");
        }
        
        if (record.getStuNation() != null) {
            sql.SET("stu_nation = #{record.stuNation,jdbcType=VARCHAR}");
        }
        
        if (record.getBirthday() != null) {
            sql.SET("birthday = #{record.birthday,jdbcType=DATE}");
        }
        
        if (record.getNativePalce() != null) {
            sql.SET("native_palce = #{record.nativePalce,jdbcType=VARCHAR}");
        }
        
        if (record.getDomicile() != null) {
            sql.SET("domicile = #{record.domicile,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceId() != null) {
            sql.SET("province_id = #{record.provinceId,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceName() != null) {
            sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}");
        }
        
        if (record.getCityId() != null) {
            sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityName() != null) {
            sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaId() != null) {
            sql.SET("area_id = #{record.areaId,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaName() != null) {
            sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}");
        }
        
        if (record.getSchId() != null) {
            sql.SET("sch_id = #{record.schId,jdbcType=VARCHAR}");
        }
        
        if (record.getSchName() != null) {
            sql.SET("sch_name = #{record.schName,jdbcType=VARCHAR}");
        }
        
        if (record.getHighSchName() != null) {
            sql.SET("high_sch_name = #{record.highSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getMidSchName() != null) {
            sql.SET("mid_sch_name = #{record.midSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getScFaculty() != null) {
            sql.SET("sc_faculty = #{record.scFaculty,jdbcType=VARCHAR}");
        }
        
        if (record.getRuxueTime() != null) {
            sql.SET("ruxue_time = #{record.ruxueTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getXuekeType() != null) {
            sql.SET("xueke_type = #{record.xuekeType,jdbcType=SMALLINT}");
        }
        
        if (record.getCreateBy() != null) {
            sql.SET("create_by = #{record.createBy,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateDate() != null) {
            sql.SET("create_date = #{record.createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.SET("update_by = #{record.updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateDate() != null) {
            sql.SET("update_date = #{record.updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDelFlag() != null) {
            sql.SET("del_flag = #{record.delFlag,jdbcType=SMALLINT}");
        }
        
        applyWhere(sql, example, true);
        return sql.toString();
    }

    /** biz_student */
    public String updateByExample(Map<String, Object> parameter) {
        SQL sql = new SQL();
        sql.UPDATE("biz_student");
        
        sql.SET("id = #{record.id,jdbcType=VARCHAR}");
        sql.SET("stu_name = #{record.stuName,jdbcType=VARCHAR}");
        sql.SET("stu_height = #{record.stuHeight,jdbcType=DOUBLE}");
        sql.SET("stu_weight = #{record.stuWeight,jdbcType=DOUBLE}");
        sql.SET("job_status = #{record.jobStatus,jdbcType=INTEGER}");
        sql.SET("tel_no = #{record.telNo,jdbcType=VARCHAR}");
        sql.SET("password = #{record.password,jdbcType=VARCHAR}");
        sql.SET("gender = #{record.gender,jdbcType=SMALLINT}");
        sql.SET("percent = #{record.percent,jdbcType=DOUBLE}");
        sql.SET("subject_id = #{record.subjectId,jdbcType=VARCHAR}");
        sql.SET("subject_name = #{record.subjectName,jdbcType=VARCHAR}");
        sql.SET("jifen_all_amount = #{record.jifenAllAmount,jdbcType=INTEGER}");
        sql.SET("jifen_amount = #{record.jifenAmount,jdbcType=INTEGER}");
        sql.SET("pic_head = #{record.picHead,jdbcType=VARCHAR}");
        sql.SET("pic_body = #{record.picBody,jdbcType=VARCHAR}");
        sql.SET("pic_nomake = #{record.picNomake,jdbcType=VARCHAR}");
        sql.SET("pic_life = #{record.picLife,jdbcType=VARCHAR}");
        sql.SET("college_level = #{record.collegeLevel,jdbcType=VARCHAR}");
        sql.SET("faculty = #{record.faculty,jdbcType=VARCHAR}");
        sql.SET("stu_nation = #{record.stuNation,jdbcType=VARCHAR}");
        sql.SET("birthday = #{record.birthday,jdbcType=DATE}");
        sql.SET("native_palce = #{record.nativePalce,jdbcType=VARCHAR}");
        sql.SET("domicile = #{record.domicile,jdbcType=VARCHAR}");
        sql.SET("province_id = #{record.provinceId,jdbcType=VARCHAR}");
        sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}");
        sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}");
        sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}");
        sql.SET("area_id = #{record.areaId,jdbcType=VARCHAR}");
        sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}");
        sql.SET("sch_id = #{record.schId,jdbcType=VARCHAR}");
        sql.SET("sch_name = #{record.schName,jdbcType=VARCHAR}");
        sql.SET("high_sch_name = #{record.highSchName,jdbcType=VARCHAR}");
        sql.SET("mid_sch_name = #{record.midSchName,jdbcType=VARCHAR}");
        sql.SET("sc_faculty = #{record.scFaculty,jdbcType=VARCHAR}");
        sql.SET("ruxue_time = #{record.ruxueTime,jdbcType=TIMESTAMP}");
        sql.SET("xueke_type = #{record.xuekeType,jdbcType=SMALLINT}");
        sql.SET("create_by = #{record.createBy,jdbcType=VARCHAR}");
        sql.SET("create_date = #{record.createDate,jdbcType=TIMESTAMP}");
        sql.SET("update_by = #{record.updateBy,jdbcType=VARCHAR}");
        sql.SET("update_date = #{record.updateDate,jdbcType=TIMESTAMP}");
        sql.SET("del_flag = #{record.delFlag,jdbcType=SMALLINT}");
        
        BizStudentExample example = (BizStudentExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    /** biz_student */
    public String updateByPrimaryKeySelective(BizStudent record) {
        SQL sql = new SQL();
        sql.UPDATE("biz_student");
        
        if (record.getStuName() != null) {
            sql.SET("stu_name = #{stuName,jdbcType=VARCHAR}");
        }
        
        if (record.getStuHeight() != null) {
            sql.SET("stu_height = #{stuHeight,jdbcType=DOUBLE}");
        }
        
        if (record.getStuWeight() != null) {
            sql.SET("stu_weight = #{stuWeight,jdbcType=DOUBLE}");
        }
        
        if (record.getJobStatus() != null) {
            sql.SET("job_status = #{jobStatus,jdbcType=INTEGER}");
        }
        
        if (record.getTelNo() != null) {
            sql.SET("tel_no = #{telNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.SET("password = #{password,jdbcType=VARCHAR}");
        }
        
        if (record.getGender() != null) {
            sql.SET("gender = #{gender,jdbcType=SMALLINT}");
        }
        
        if (record.getPercent() != null) {
            sql.SET("percent = #{percent,jdbcType=DOUBLE}");
        }
        
        if (record.getSubjectId() != null) {
            sql.SET("subject_id = #{subjectId,jdbcType=VARCHAR}");
        }
        
        if (record.getSubjectName() != null) {
            sql.SET("subject_name = #{subjectName,jdbcType=VARCHAR}");
        }
        
        if (record.getJifenAllAmount() != null) {
            sql.SET("jifen_all_amount = #{jifenAllAmount,jdbcType=INTEGER}");
        }
        
        if (record.getJifenAmount() != null) {
            sql.SET("jifen_amount = #{jifenAmount,jdbcType=INTEGER}");
        }
        
        if (record.getPicHead() != null) {
            sql.SET("pic_head = #{picHead,jdbcType=VARCHAR}");
        }
        
        if (record.getPicBody() != null) {
            sql.SET("pic_body = #{picBody,jdbcType=VARCHAR}");
        }
        
        if (record.getPicNomake() != null) {
            sql.SET("pic_nomake = #{picNomake,jdbcType=VARCHAR}");
        }
        
        if (record.getPicLife() != null) {
            sql.SET("pic_life = #{picLife,jdbcType=VARCHAR}");
        }
        
        if (record.getCollegeLevel() != null) {
            sql.SET("college_level = #{collegeLevel,jdbcType=VARCHAR}");
        }
        
        if (record.getFaculty() != null) {
            sql.SET("faculty = #{faculty,jdbcType=VARCHAR}");
        }
        
        if (record.getStuNation() != null) {
            sql.SET("stu_nation = #{stuNation,jdbcType=VARCHAR}");
        }
        
        if (record.getBirthday() != null) {
            sql.SET("birthday = #{birthday,jdbcType=DATE}");
        }
        
        if (record.getNativePalce() != null) {
            sql.SET("native_palce = #{nativePalce,jdbcType=VARCHAR}");
        }
        
        if (record.getDomicile() != null) {
            sql.SET("domicile = #{domicile,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceId() != null) {
            sql.SET("province_id = #{provinceId,jdbcType=VARCHAR}");
        }
        
        if (record.getProvinceName() != null) {
            sql.SET("province_name = #{provinceName,jdbcType=VARCHAR}");
        }
        
        if (record.getCityId() != null) {
            sql.SET("city_id = #{cityId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityName() != null) {
            sql.SET("city_name = #{cityName,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaId() != null) {
            sql.SET("area_id = #{areaId,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaName() != null) {
            sql.SET("area_name = #{areaName,jdbcType=VARCHAR}");
        }
        
        if (record.getSchId() != null) {
            sql.SET("sch_id = #{schId,jdbcType=VARCHAR}");
        }
        
        if (record.getSchName() != null) {
            sql.SET("sch_name = #{schName,jdbcType=VARCHAR}");
        }
        
        if (record.getHighSchName() != null) {
            sql.SET("high_sch_name = #{highSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getMidSchName() != null) {
            sql.SET("mid_sch_name = #{midSchName,jdbcType=VARCHAR}");
        }
        
        if (record.getScFaculty() != null) {
            sql.SET("sc_faculty = #{scFaculty,jdbcType=VARCHAR}");
        }
        
        if (record.getRuxueTime() != null) {
            sql.SET("ruxue_time = #{ruxueTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getXuekeType() != null) {
            sql.SET("xueke_type = #{xuekeType,jdbcType=SMALLINT}");
        }
        
        if (record.getCreateBy() != null) {
            sql.SET("create_by = #{createBy,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateDate() != null) {
            sql.SET("create_date = #{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.SET("update_by = #{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateDate() != null) {
            sql.SET("update_date = #{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDelFlag() != null) {
            sql.SET("del_flag = #{delFlag,jdbcType=SMALLINT}");
        }
        
        sql.WHERE("id = #{id,jdbcType=VARCHAR}");
        
        return sql.toString();
    }

    /** biz_student */
    protected void applyWhere(SQL sql, BizStudentExample example, boolean includeExamplePhrase) {
        if (example == null) {
            return;
        }
        
        String parmPhrase1;
        String parmPhrase1_th;
        String parmPhrase2;
        String parmPhrase2_th;
        String parmPhrase3;
        String parmPhrase3_th;
        if (includeExamplePhrase) {
            parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
            parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
            parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
            parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
            parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
            parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
        } else {
            parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
            parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
            parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
            parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
            parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
            parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
        }
        
        StringBuilder sb = new StringBuilder();
        List<Criteria> oredCriteria = example.getOredCriteria();
        boolean firstCriteria = true;
        for (int i = 0; i < oredCriteria.size(); i++) {
            Criteria criteria = oredCriteria.get(i);
            if (criteria.isValid()) {
                if (firstCriteria) {
                    firstCriteria = false;
                } else {
                    sb.append(" or ");
                }
                
                sb.append('(');
                List<Criterion> criterions = criteria.getAllCriteria();
                boolean firstCriterion = true;
                for (int j = 0; j < criterions.size(); j++) {
                    Criterion criterion = criterions.get(j);
                    if (firstCriterion) {
                        firstCriterion = false;
                    } else {
                        sb.append(" and ");
                    }
                    
                    if (criterion.isNoValue()) {
                        sb.append(criterion.getCondition());
                    } else if (criterion.isSingleValue()) {
                        if (criterion.getTypeHandler() == null) {
                            sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
                        } else {
                            sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
                        }
                    } else if (criterion.isBetweenValue()) {
                        if (criterion.getTypeHandler() == null) {
                            sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
                        } else {
                            sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
                        }
                    } else if (criterion.isListValue()) {
                        sb.append(criterion.getCondition());
                        sb.append(" (");
                        List<?> listItems = (List<?>) criterion.getValue();
                        boolean comma = false;
                        for (int k = 0; k < listItems.size(); k++) {
                            if (comma) {
                                sb.append(", ");
                            } else {
                                comma = true;
                            }
                            if (criterion.getTypeHandler() == null) {
                                sb.append(String.format(parmPhrase3, i, j, k));
                            } else {
                                sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
                            }
                        }
                        sb.append(')');
                    }
                }
                sb.append(')');
            }
        }
        
        if (sb.length() > 0) {
            sql.WHERE(sb.toString());
        }
    }
}